home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3920 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Question on argv
  5. Date: 31 Jan 1996 15:21 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <31JAN199615214435@erich.triumf.ca>
  9. References: <4eoq3c$45j@usenet.ucs.indiana.edu>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4eoq3c$45j@usenet.ucs.indiana.edu>, gompa@nickel.ucs.indiana.edu (Raghu R. Gompa) writes...
  14. >I am writing a program in which I want to
  15. >retrieve the arguments argv[1] ... argv[4].
  16. >argv[1] .. argv[3] are strings of characters.
  17. >I want to use argv[4] as an integer.  Can
  18. >I do that?  and how?   Thank you for your
  19. >help in advance. .. Raghu
  20.  
  21. All the command line areguments are passed to your program as strings.  Use
  22. your favourite method to convert the string to a number - sscanf() is portable,
  23. but you may also have atoi().
  24.  
  25. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  26. Internet: bennett@triumf.ca         | of one another only when one can be
  27. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  28. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  29. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  30.  
  31.  
  32.  
  33.  
  34.